from aip import AipOcr

""" 你的 APPID AK SK """
APP_ID = '18608539'
API_KEY = 'zzp7NES5bTOBG0du7UsKTKAl'
SECRET_KEY = 'XCZAyGfXhTcVbGHfKMmeVmAIamK0xrfl'

client = AipOcr(APP_ID, API_KEY, SECRET_KEY)    # 连接接口

""" 读取图片 """
def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        return fp.read()

image = get_file_content('1.jpg')

""" 调用通用文字识别, 图片参数为本地图片 """
data = client.basicGeneral(image)
print(type(data))
print(data)
res = data['words_result'][0]['words']
print(res)

